<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%--@elvariable id="contextPath" type="java.lang.String"--%>
<%--@elvariable id="topics" type="java.util.List<org.parademo.web.model.ProposalFormView>"--%>
<form:form action="${contextPath}/proposals/${proposal.id}?submit" method="POST" commandName="proposal" class="submitProposalForm" id="submitProposalForm" >

    <h1>${title}</h1>

    <table>
        <tr>
            <td>
                <label for="title">Title</label>
            </td>
            <td>
                <span id="title">${proposal.title}</span>
            </td>
        </tr>
        <tr>
            <td>
                <label for="topics">Category/Topic</label>
            </td>
            <td>
                <span id="topics">${proposal.topic}</span>
            </td>
        </tr>
        <tr>
            <td>
                <label for="votingEndDate">Voting end date</label>
            </td>
            <td>
                <span id="votingEndDate">${proposal.votingEndDate}</span>
            </td>
        </tr>
        <tr>
            <td>
                <label for="description">Detail (*)</label>
            </td>
            <td>
                <span id="description">${proposal.description}</span>
            </td>
        </tr>
    </table>

    <div>
        <c:if test="${not proposal.submitted}">
            <a class="medium black button" href="javascript:" onclick="document.getElementById('submitProposalForm').submit();">Submit Proposal</a>
        </c:if>
        <a class="medium red button" href="${contextPath}/my-proposals">Back</a>
    </div>
</form:form>
